/**
* Copyright @ 2023 iAuto (Shanghai) Co., Ltd.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are NOT permitted except as agreed by
* iAuto (Shanghai) Co., Ltd.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/


// 服务管理、能力管理可展开组件
import React from 'react';
import { Tabs } from 'antd';
import { pageTabsProps } from '@/types/components'
import CustomBadge from '@/components/common/CustomBadge';
import styles from './index.less'

const PageTabs: React.FC<pageTabsProps> = (props) => {
    const {
        tabPaneList = [],
        unpublishTotal = 0,
        activeKey = 1,
        setActiveKey = () => {
            // 设置选择的key
         },
    } = props;
    return (
        <div className={styles.tabContainer}>
            <Tabs
                activeKey={String(activeKey)}
                onChange={(e) => setActiveKey(Number(e))}
            >
                {
                    tabPaneList.map((item: string, index: number) => {
                        if (item.includes('未发布')) {
                            return <Tabs.TabPane key={index + 1} tab={<CustomBadge size="small" count={String(unpublishTotal)} offset={[10, 8]}>
                                {tabPaneList[1]}
                            </CustomBadge>} />
                        } else {
                            return <Tabs.TabPane key={index + 1} tab={item} />
                        }
                    })
                }
            </Tabs>
        </div>
    )
}
export default PageTabs;